package com.shrcl.engineerprocess.domain.events;

import com.shrcl.engineerprocess.domain.EngineerProjectAssignment;
import com.shrcl.engineerprocess.domain.EngineerWorkOrder;
import com.shrcl.engineerprocess.domain.events.EngineerWorkOrderEventsListener;
import edu.fudan.mylang.pf.event.EntityEventsManager;
import java.util.Collection;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("com.shrcl.engineerprocess.domain.events.EngineerWorkOrderEventsManager")
public class EngineerWorkOrderEventsManager extends EntityEventsManager<EngineerWorkOrder> {
  @Autowired(required = false)
  private Collection<EngineerWorkOrderEventsListener> listeners = com.google.common.collect.Lists.newArrayList();;
  
  protected Collection<EngineerWorkOrderEventsListener> getListeners() {
    return listeners;
  }
  
  public void fire$taskFinish(final EngineerWorkOrder entity, final EngineerProjectAssignment projectAssignment) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerWorkOrderEventsListener)listener).$taskFinish(entity,projectAssignment);
    }
    
  }
  
  public void fire$taskCancel(final EngineerWorkOrder entity, final EngineerProjectAssignment projectAssignment) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerWorkOrderEventsListener)listener).$taskCancel(entity,projectAssignment);
    }
    
  }
  
  public void firePendingApply(final EngineerWorkOrder entity) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerWorkOrderEventsListener)listener).pendingApply(entity);
    }
    
  }
  
  public void firePendingApprove(final EngineerWorkOrder entity) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerWorkOrderEventsListener)listener).pendingApprove(entity);
    }
    
  }
  
  public void firePendingReject(final EngineerWorkOrder entity) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerWorkOrderEventsListener)listener).pendingReject(entity);
    }
    
  }
  
  public void fireFinish(final EngineerWorkOrder entity) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerWorkOrderEventsListener)listener).finish(entity);
    }
    
  }
  
  public void fireAddAssignment(final EngineerWorkOrder entity, final Procedure1<? super EngineerProjectAssignment> init) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerWorkOrderEventsListener)listener).addAssignment(entity,init);
    }
    
  }
  
  public void fireDelAssignment(final EngineerWorkOrder entity, final EngineerProjectAssignment assignment) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerWorkOrderEventsListener)listener).delAssignment(entity,assignment);
    }
    
  }
  
  public void fireCommitFinish(final EngineerWorkOrder entity) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerWorkOrderEventsListener)listener).commitFinish(entity);
    }
    
  }
  
  public void fire$startexecute(final EngineerWorkOrder entity, final EngineerProjectAssignment projectAssignment) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerWorkOrderEventsListener)listener).$startexecute(entity,projectAssignment);
    }
    
  }
}
